package com.kingdee.eas.xr.helper;

/*jadclipse*/// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.


import java.io.PrintStream;
import java.lang.reflect.Array;
import java.util.*;

public class EcArrayUtil
{

    public EcArrayUtil()
    {
    }

    public static boolean isAllNull(Object objectArr[])
    {
        boolean flag = true;
        if(null != objectArr)
        {
            int length = objectArr.length;
            int i = 0;
            do
            {
                if(i >= length)
                    break;
                if(null != objectArr[i])
                {
                    flag = false;
                    break;
                }
                i++;
            } while(true);
        }
        return flag;
    }

    public static boolean isSomeNull(Object objectArr[])
    {
        boolean flag = false;
        if(null != objectArr)
        {
            int length = objectArr.length;
            int i = 0;
            do
            {
                if(i >= length)
                    break;
                if(null == objectArr[i])
                {
                    flag = true;
                    break;
                }
                i++;
            } while(true);
        }
        return flag;
    }

    public static Object[] add(Object objectArr[], Object object)
    {
        Object newObjectArr[] = null;
        int length = objectArr.length;
        newObjectArr = new Object[length + 1];
        System.arraycopy(((Object) (objectArr)), 0, ((Object) (newObjectArr)), 0, length);
        newObjectArr[length] = object;
        return newObjectArr;
    }

    public static Object[] add(Object objectArr[], Object object, Object castArr[])
    {
        Object newObjectArr[] = null;
        int length = objectArr.length;
        newObjectArr = new Object[length + 1];
        System.arraycopy(((Object) (objectArr)), 0, ((Object) (newObjectArr)), 0, length);
        newObjectArr[length] = object;
        List list = Arrays.asList(newObjectArr);
        castArr = list.toArray(castArr);
        return castArr;
    }

    public static Object[] addAll(Object objectArr1[], Object objectArr2[])
    {
        Object newObjectArr[] = null;
        int length1 = objectArr1.length;
        int length2 = objectArr2.length;
        newObjectArr = new Object[length1 + length2];
        System.arraycopy(((Object) (objectArr1)), 0, ((Object) (newObjectArr)), 0, length1);
        System.arraycopy(((Object) (objectArr2)), 0, ((Object) (newObjectArr)), length1, length2);
        return newObjectArr;
    }

    public static Object[] addAll(Object objectArr1[], Object objectArr2[], Object castArr[])
    {
        Object newObjectArr[] = null;
        int length1 = objectArr1.length;
        int length2 = objectArr2.length;
        newObjectArr = new Object[length1 + length2];
        System.arraycopy(((Object) (objectArr1)), 0, ((Object) (newObjectArr)), 0, length1);
        System.arraycopy(((Object) (objectArr2)), 0, ((Object) (newObjectArr)), length1, length2);
        List list = Arrays.asList(newObjectArr);
        castArr = list.toArray(castArr);
        return castArr;
    }

    public static void debugPrint(PrintStream pr, Object arr[])
    {
        if(null != arr)
        {
            List list = new ArrayList(Arrays.asList(arr));
            pr.println(list);
        }
    }

    public static Object[] cast(Object origArr[], Object destArr[])
    {
        Object arrRs[] = null;
        if(null != origArr)
        {
            Class origCmpType = ((Object) (origArr)).getClass().getComponentType();
            Class destCmpType = ((Object) (destArr)).getClass().getComponentType();
            if(origCmpType.equals(destCmpType))
            {
                arrRs = origArr;
            } else
            {
                List list = Arrays.asList(origArr);
                arrRs = list.toArray(destArr);
            }
        }
        return arrRs;
    }

    public static Object[] cast(Object origArr[], Class destArrCmpType)
    {
        Object destArr[] = (Object[])(Object[])Array.newInstance(destArrCmpType, 0);
        destArr = cast(origArr, destArr);
        return destArr;
    }

    public static Class[] toClassArr(Object origArr[])
    {
        Class destArr[] = EMPTY_CLASS_ARRAY;
        destArr = (Class[])(Class[])cast(origArr, destArr);
        return destArr;
    }

    public static String[] toStringArr(Object origArr[])
    {
        String destArr[] = EMPTY_STRING_ARRAY;
        destArr = (String[])(String[])cast(origArr, destArr);
        return destArr;
    }

    public static Long[] toLongArr(Object origArr[])
    {
        Long castArr[] = EMPTY_LONG_OBJECT_ARRAY;
        castArr = (Long[])(Long[])cast(origArr, castArr);
        return castArr;
    }

    public static Integer[] toIntegerArr(Object origArr[])
    {
        Integer castArr[] = EMPTY_INTEGER_OBJECT_ARRAY;
        castArr = (Integer[])(Integer[])cast(origArr, castArr);
        return castArr;
    }

    public static Short[] toShortArr(Object origArr[])
    {
        Short castArr[] = EMPTY_SHORT_OBJECT_ARRAY;
        castArr = (Short[])(Short[])cast(origArr, castArr);
        return castArr;
    }

    public static Byte[] toByteArr(Object origArr[])
    {
        Byte castArr[] = EMPTY_BYTE_OBJECT_ARRAY;
        castArr = (Byte[])(Byte[])cast(origArr, castArr);
        return castArr;
    }

    public static Double[] toDoubleArr(Object origArr[])
    {
        Double castArr[] = EMPTY_DOUBLE_OBJECT_ARRAY;
        castArr = (Double[])(Double[])cast(origArr, castArr);
        return castArr;
    }

    public static Float[] toFloatArr(Object origArr[])
    {
        Float castArr[] = EMPTY_FLOAT_OBJECT_ARRAY;
        castArr = (Float[])(Float[])cast(origArr, castArr);
        return castArr;
    }

    public static Boolean[] toBooleanArr(Object origArr[])
    {
        Boolean castArr[] = EMPTY_BOOLEAN_OBJECT_ARRAY;
        castArr = (Boolean[])(Boolean[])cast(origArr, castArr);
        return castArr;
    }

    public static Character[] toCharacterArr(Object origArr[])
    {
        Character castArr[] = EMPTY_CHARACTER_OBJECT_ARRAY;
        castArr = (Character[])(Character[])cast(origArr, castArr);
        return castArr;
    }

    public static String toString(Object array[])
    {
        String stringResonse = null;
        if(null == array)
            stringResonse = "null";
        else
        if(0 == array.length)
        {
            stringResonse = "[]";
        } else
        {
            StringBuffer stringBuffer = new StringBuffer();
            String joinFrag = ", ";
            stringBuffer.append("[");
            Object object = null;
            int i = 0;
            for(int len = array.length; i < len; i++)
            {
                object = array[i];
                stringBuffer.append(object).append(joinFrag);
            }

            stringBuffer.delete(stringBuffer.length() - 2, stringBuffer.length());
            stringBuffer.append("]");
            stringResonse = stringBuffer.toString();
        }
        return stringResonse;
    }

    public static String toString(Object array[], String leftFrag, String rightFrag, String joinFrag)
    {
        String stringResonse = null;
        leftFrag = null != leftFrag ? leftFrag : "null";
        rightFrag = null != rightFrag ? rightFrag : "null";
        joinFrag = null != joinFrag ? joinFrag : "null";
        if(null == array)
            stringResonse = "null";
        else
        if(0 == array.length)
        {
            stringResonse = (new StringBuilder()).append(leftFrag).append(rightFrag).toString();
        } else
        {
            StringBuffer stringBuffer = new StringBuffer();
            stringBuffer.append(leftFrag);
            Object object = null;
            int i = 0;
            for(int len = array.length; i < len; i++)
            {
                object = array[i];
                stringBuffer.append(object).append(joinFrag);
            }

            stringBuffer.delete(stringBuffer.length() - joinFrag.length(), stringBuffer.length());
            stringBuffer.append(rightFrag);
            stringResonse = stringBuffer.toString();
        }
        return stringResonse;
    }

    public static int indexOf(Object array[], Object objectToFind)
    {
        return indexOf(array, objectToFind, 0);
    }

    public static int indexOf(Object array[], Object objectToFind, int startIndex)
    {
        if(array == null)
            return -1;
        if(startIndex < 0)
            startIndex = 0;
        if(objectToFind == null)
        {
            for(int i = startIndex; i < array.length; i++)
                if(array[i] == null)
                    return i;

        } else
        {
            for(int i = startIndex; i < array.length; i++)
                if(objectToFind.equals(array[i]))
                    return i;

        }
        return -1;
    }

    public static int lastIndexOf(Object array[], Object objectToFind)
    {
        return lastIndexOf(array, objectToFind, 2147483647);
    }

    public static int lastIndexOf(Object array[], Object objectToFind, int startIndex)
    {
        if(array == null)
            return -1;
        if(startIndex < 0)
            return -1;
        if(startIndex >= array.length)
            startIndex = array.length - 1;
        if(objectToFind == null)
        {
            for(int i = startIndex; i >= 0; i--)
                if(array[i] == null)
                    return i;

        } else
        {
            for(int i = startIndex; i >= 0; i--)
                if(objectToFind.equals(array[i]))
                    return i;

        }
        return -1;
    }

    public static boolean contains(Object array[], Object objectToFind)
    {
        return indexOf(array, objectToFind) != -1;
    }

    public static int indexOf(long array[], long valueToFind)
    {
        return indexOf(array, valueToFind, 0);
    }

    public static int indexOf(long array[], long valueToFind, int startIndex)
    {
        if(array == null)
            return -1;
        if(startIndex < 0)
            startIndex = 0;
        for(int i = startIndex; i < array.length; i++)
            if(valueToFind == array[i])
                return i;

        return -1;
    }

    public static int lastIndexOf(long array[], long valueToFind)
    {
        return lastIndexOf(array, valueToFind, 2147483647);
    }

    public static int lastIndexOf(long array[], long valueToFind, int startIndex)
    {
        if(array == null)
            return -1;
        if(startIndex < 0)
            return -1;
        if(startIndex >= array.length)
            startIndex = array.length - 1;
        for(int i = startIndex; i >= 0; i--)
            if(valueToFind == array[i])
                return i;

        return -1;
    }

    public static boolean contains(long array[], long valueToFind)
    {
        return indexOf(array, valueToFind) != -1;
    }

    public static int indexOf(int array[], int valueToFind)
    {
        return indexOf(array, valueToFind, 0);
    }

    public static int indexOf(int array[], int valueToFind, int startIndex)
    {
        if(array == null)
            return -1;
        if(startIndex < 0)
            startIndex = 0;
        for(int i = startIndex; i < array.length; i++)
            if(valueToFind == array[i])
                return i;

        return -1;
    }

    public static int lastIndexOf(int array[], int valueToFind)
    {
        return lastIndexOf(array, valueToFind, 2147483647);
    }

    public static int lastIndexOf(int array[], int valueToFind, int startIndex)
    {
        if(array == null)
            return -1;
        if(startIndex < 0)
            return -1;
        if(startIndex >= array.length)
            startIndex = array.length - 1;
        for(int i = startIndex; i >= 0; i--)
            if(valueToFind == array[i])
                return i;

        return -1;
    }

    public static boolean contains(int array[], int valueToFind)
    {
        return indexOf(array, valueToFind) != -1;
    }

    public static int indexOf(short array[], short valueToFind)
    {
        return indexOf(array, valueToFind, 0);
    }

    public static int indexOf(short array[], short valueToFind, int startIndex)
    {
        if(array == null)
            return -1;
        if(startIndex < 0)
            startIndex = 0;
        for(int i = startIndex; i < array.length; i++)
            if(valueToFind == array[i])
                return i;

        return -1;
    }

    public static int lastIndexOf(short array[], short valueToFind)
    {
        return lastIndexOf(array, valueToFind, 2147483647);
    }

    public static int lastIndexOf(short array[], short valueToFind, int startIndex)
    {
        if(array == null)
            return -1;
        if(startIndex < 0)
            return -1;
        if(startIndex >= array.length)
            startIndex = array.length - 1;
        for(int i = startIndex; i >= 0; i--)
            if(valueToFind == array[i])
                return i;

        return -1;
    }

    public static boolean contains(short array[], short valueToFind)
    {
        return indexOf(array, valueToFind) != -1;
    }

    public static int indexOf(char array[], char valueToFind)
    {
        return indexOf(array, valueToFind, 0);
    }

    public static int indexOf(char array[], char valueToFind, int startIndex)
    {
        if(array == null)
            return -1;
        if(startIndex < 0)
            startIndex = 0;
        for(int i = startIndex; i < array.length; i++)
            if(valueToFind == array[i])
                return i;

        return -1;
    }

    public static int lastIndexOf(char array[], char valueToFind)
    {
        return lastIndexOf(array, valueToFind, 2147483647);
    }

    public static int lastIndexOf(char array[], char valueToFind, int startIndex)
    {
        if(array == null)
            return -1;
        if(startIndex < 0)
            return -1;
        if(startIndex >= array.length)
            startIndex = array.length - 1;
        for(int i = startIndex; i >= 0; i--)
            if(valueToFind == array[i])
                return i;

        return -1;
    }

    public static boolean contains(char array[], char valueToFind)
    {
        return indexOf(array, valueToFind) != -1;
    }

    public static int indexOf(byte array[], byte valueToFind)
    {
        return indexOf(array, valueToFind, 0);
    }

    public static int indexOf(byte array[], byte valueToFind, int startIndex)
    {
        if(array == null)
            return -1;
        if(startIndex < 0)
            startIndex = 0;
        for(int i = startIndex; i < array.length; i++)
            if(valueToFind == array[i])
                return i;

        return -1;
    }

    public static int lastIndexOf(byte array[], byte valueToFind)
    {
        return lastIndexOf(array, valueToFind, 2147483647);
    }

    public static int lastIndexOf(byte array[], byte valueToFind, int startIndex)
    {
        if(array == null)
            return -1;
        if(startIndex < 0)
            return -1;
        if(startIndex >= array.length)
            startIndex = array.length - 1;
        for(int i = startIndex; i >= 0; i--)
            if(valueToFind == array[i])
                return i;

        return -1;
    }

    public static boolean contains(byte array[], byte valueToFind)
    {
        return indexOf(array, valueToFind) != -1;
    }

    public static int indexOf(double array[], double valueToFind)
    {
        return indexOf(array, valueToFind, 0);
    }

    public static int indexOf(double array[], double valueToFind, double tolerance)
    {
        return indexOf(array, valueToFind, 0, tolerance);
    }

    public static int indexOf(double array[], double valueToFind, int startIndex)
    {
        if(isEmpty(array))
            return -1;
        if(startIndex < 0)
            startIndex = 0;
        for(int i = startIndex; i < array.length; i++)
            if(valueToFind == array[i])
                return i;

        return -1;
    }

    public static int indexOf(double array[], double valueToFind, int startIndex, double tolerance)
    {
        if(isEmpty(array))
            return -1;
        if(startIndex < 0)
            startIndex = 0;
        double min = valueToFind - tolerance;
        double max = valueToFind + tolerance;
        for(int i = startIndex; i < array.length; i++)
            if(array[i] >= min && array[i] <= max)
                return i;

        return -1;
    }

    public static int lastIndexOf(double array[], double valueToFind)
    {
        return lastIndexOf(array, valueToFind, 2147483647);
    }

    public static int lastIndexOf(double array[], double valueToFind, double tolerance)
    {
        return lastIndexOf(array, valueToFind, 2147483647, tolerance);
    }

    public static int lastIndexOf(double array[], double valueToFind, int startIndex)
    {
        if(isEmpty(array))
            return -1;
        if(startIndex < 0)
            return -1;
        if(startIndex >= array.length)
            startIndex = array.length - 1;
        for(int i = startIndex; i >= 0; i--)
            if(valueToFind == array[i])
                return i;

        return -1;
    }

    public static int lastIndexOf(double array[], double valueToFind, int startIndex, double tolerance)
    {
        if(isEmpty(array))
            return -1;
        if(startIndex < 0)
            return -1;
        if(startIndex >= array.length)
            startIndex = array.length - 1;
        double min = valueToFind - tolerance;
        double max = valueToFind + tolerance;
        for(int i = startIndex; i >= 0; i--)
            if(array[i] >= min && array[i] <= max)
                return i;

        return -1;
    }

    public static boolean contains(double array[], double valueToFind)
    {
        return indexOf(array, valueToFind) != -1;
    }

    public static boolean contains(double array[], double valueToFind, double tolerance)
    {
        return indexOf(array, valueToFind, 0, tolerance) != -1;
    }

    public static int indexOf(float array[], float valueToFind)
    {
        return indexOf(array, valueToFind, 0);
    }

    public static int indexOf(float array[], float valueToFind, int startIndex)
    {
        if(isEmpty(array))
            return -1;
        if(startIndex < 0)
            startIndex = 0;
        for(int i = startIndex; i < array.length; i++)
            if(valueToFind == array[i])
                return i;

        return -1;
    }

    public static int lastIndexOf(float array[], float valueToFind)
    {
        return lastIndexOf(array, valueToFind, 2147483647);
    }

    public static int lastIndexOf(float array[], float valueToFind, int startIndex)
    {
        if(isEmpty(array))
            return -1;
        if(startIndex < 0)
            return -1;
        if(startIndex >= array.length)
            startIndex = array.length - 1;
        for(int i = startIndex; i >= 0; i--)
            if(valueToFind == array[i])
                return i;

        return -1;
    }

    public static boolean contains(float array[], float valueToFind)
    {
        return indexOf(array, valueToFind) != -1;
    }

    public static int indexOf(boolean array[], boolean valueToFind)
    {
        return indexOf(array, valueToFind, 0);
    }

    public static int indexOf(boolean array[], boolean valueToFind, int startIndex)
    {
        if(isEmpty(array))
            return -1;
        if(startIndex < 0)
            startIndex = 0;
        for(int i = startIndex; i < array.length; i++)
            if(valueToFind == array[i])
                return i;

        return -1;
    }

    public static int lastIndexOf(boolean array[], boolean valueToFind)
    {
        return lastIndexOf(array, valueToFind, 2147483647);
    }

    public static int lastIndexOf(boolean array[], boolean valueToFind, int startIndex)
    {
        if(isEmpty(array))
            return -1;
        if(startIndex < 0)
            return -1;
        if(startIndex >= array.length)
            startIndex = array.length - 1;
        for(int i = startIndex; i >= 0; i--)
            if(valueToFind == array[i])
                return i;

        return -1;
    }

    public static boolean contains(boolean array[], boolean valueToFind)
    {
        return indexOf(array, valueToFind) != -1;
    }

    public static boolean isEmpty(Object array[])
    {
        return array == null || array.length == 0;
    }

    public static boolean isEmpty(long array[])
    {
        return array == null || array.length == 0;
    }

    public static boolean isEmpty(int array[])
    {
        return array == null || array.length == 0;
    }

    public static boolean isEmpty(short array[])
    {
        return array == null || array.length == 0;
    }

    public static boolean isEmpty(char array[])
    {
        return array == null || array.length == 0;
    }

    public static boolean isEmpty(byte array[])
    {
        return array == null || array.length == 0;
    }

    public static boolean isEmpty(double array[])
    {
        return array == null || array.length == 0;
    }

    public static boolean isEmpty(float array[])
    {
        return array == null || array.length == 0;
    }

    public static boolean isEmpty(boolean array[])
    {
        return array == null || array.length == 0;
    }

    public static boolean isNotEmpty(Object objectArr[])
    {
        return !isEmpty(objectArr);
    }

    public static int indexOf(String array[], String stringToFind, boolean isEqualsIgnoreCase)
    {
        return indexOf(array, stringToFind, 0, isEqualsIgnoreCase);
    }

    public static int indexOf(String array[], String stringToFind, int startIndex, boolean isEqualsIgnoreCase)
    {
        if(array == null)
            return -1;
        if(startIndex < 0)
            startIndex = 0;
        if(stringToFind == null)
        {
            for(int i = startIndex; i < array.length; i++)
                if(array[i] == null)
                    return i;

        } else
        if(!isEqualsIgnoreCase)
        {
            for(int i = startIndex; i < array.length; i++)
                if(stringToFind.equals(array[i]))
                    return i;

        } else
        {
            for(int i = startIndex; i < array.length; i++)
                if(stringToFind.equalsIgnoreCase(array[i]))
                    return i;

        }
        return -1;
    }

    public static boolean contains(String array[], String stringToFind, boolean isEqualsIgnoreCase)
    {
        return indexOf(array, stringToFind, isEqualsIgnoreCase) != -1;
    }

    public static Object[] clearDuplicate(Object array[])
    {
        if(isNotEmpty(array))
        {
            Set set = new LinkedHashSet(Arrays.asList(array));
            array = set.toArray(array);
        }
        return array;
    }

    public static Object[] clearNull(Object array[])
    {
        if(isNotEmpty(array))
        {
            List list = Arrays.asList(array);
            List nullList = new ArrayList();
            nullList.add(null);
            list.removeAll(nullList);
            array = list.toArray(array);
        }
        return array;
    }

    public static Object[] clearDuplicateAndNull(Object array[])
    {
        if(isNotEmpty(array))
        {
            Set set = new LinkedHashSet(Arrays.asList(array));
            set.remove(null);
            array = set.toArray(array);
        }
        return array;
    }

    public static final Object EMPTY_OBJECT_ARRAY[] = new Object[0];
    public static final Class EMPTY_CLASS_ARRAY[] = new Class[0];
    public static final String EMPTY_STRING_ARRAY[] = new String[0];
    public static final long EMPTY_LONG_ARRAY[] = new long[0];
    public static final Long EMPTY_LONG_OBJECT_ARRAY[] = new Long[0];
    public static final int EMPTY_INT_ARRAY[] = new int[0];
    public static final Integer EMPTY_INTEGER_OBJECT_ARRAY[] = new Integer[0];
    public static final short EMPTY_SHORT_ARRAY[] = new short[0];
    public static final Short EMPTY_SHORT_OBJECT_ARRAY[] = new Short[0];
    public static final byte EMPTY_BYTE_ARRAY[] = new byte[0];
    public static final Byte EMPTY_BYTE_OBJECT_ARRAY[] = new Byte[0];
    public static final double EMPTY_DOUBLE_ARRAY[] = new double[0];
    public static final Double EMPTY_DOUBLE_OBJECT_ARRAY[] = new Double[0];
    public static final float EMPTY_FLOAT_ARRAY[] = new float[0];
    public static final Float EMPTY_FLOAT_OBJECT_ARRAY[] = new Float[0];
    public static final boolean EMPTY_BOOLEAN_ARRAY[] = new boolean[0];
    public static final Boolean EMPTY_BOOLEAN_OBJECT_ARRAY[] = new Boolean[0];
    public static final char EMPTY_CHAR_ARRAY[] = new char[0];
    public static final Character EMPTY_CHARACTER_OBJECT_ARRAY[] = new Character[0];

}


/*
	DECOMPILATION REPORT

	Decompiled from: F:\qs\lib\industry\ec_common-server.jar
	Total time: 31 ms
	Jad reported messages/errors:
	Exit status: 0
	Caught exceptions:
*/